
/*have to edit industries by year as codes change by year

starting template from 99 on

1	17 - 28 	Agriculture, Forestry, and Fisheries
2	47 - 57 	Mining
3	67 - 77 	Construction
4 	107 - 398 	Manufacturing
5	407 - 479 	Transportation, Communications, and Other Public Utilities
6 	507 - 698 	Wholesale and Retail Trade
7	707 - 718 	Finance, Insurance, and Real Estate
8	727 - 759 	Business and Repair Services
9	769 - 798 	Personal Services
10	807 - 809 	Entertainment and Recreation Services
11 	828 - 897 	Professional and Related Services
12	907 - 937 	Public Administration

*/


//year 99 - 01
replace indust=1 if inrange(indust,17,28) & inrange(year,1999,2001)
replace indust=2 if inrange(indust,47,57) & inrange(year,1999,2001)
replace indust=3 if inrange(indust,67,77) & inrange(year,1999,2001)
replace indust=4 if inrange(indust,107,398) & inrange(year,1999,2001)
replace indust=5 if inrange(indust,407,479) & inrange(year,1999,2001)
replace indust=6 if inrange(indust,503,698) & inrange(year,1999,2001)
replace indust=7 if inrange(indust,707,718) & inrange(year,1999,2001)
replace indust=8 if inrange(indust,727,759) & inrange(year,1999,2001)
replace indust=9 if inrange(indust,769,798) & inrange(year,1999,2001)
replace indust=10 if inrange(indust,807,809) & inrange(year,1999,2001)
replace indust=11 if inrange(indust,828,897) & inrange(year,1999,2001)
replace indust=12 if inrange(indust,907,937) & inrange(year,1999,2001)

/*template from 03 on

1 		17 - 29 	Agriculture, Forestry, Fishing, and Hunting
2 		37 - 49 	Mining
3 		57 - 69 	Utilities
4 		77 			Construction
5 		107 - 399 	Manufacturing
6 		407 - 459 	Wholesale Trade
7 		467 - 579 	Retail Trade
8 		607 - 639 	Transportation and Warehousing
9 		647 - 679 	Information
10	 	687 - 699 	Finance and Insurance
11	 	707 - 719 	Real Estate and Rental and Leasing
12	 	727 - 749 	Professional, Scientific, and Technical Services
13	 	757 - 779 	Management, Administrative and Support, and Waste Management Services
14	 	786 - 789 	Educational Services
15	 	797 - 847 	Health Care and Social Assistance
16	 	856 - 859 	Arts, Entertainment, and Recreation
17	 	866 - 869 	Accommodations and Food Services
18	 	877 - 929 	Other Services (Except Public Administration)
19	 	937 - 987 	Public Administration and Active Duty Military


I will code down to 99 template
*/

//year 03- 15
replace indust=1 if inrange(indust,17,29) & inrange(year,2003,2015)
replace indust=2 if inrange(indust,37,49) & inrange(year,2003,2015)
replace indust=3 if indust==77 & inrange(year,2003,2015)
replace indust=4 if inrange(indust,107,399) & inrange(year,2003,2015)
replace indust=5 if ( inrange(indust,57,69) | inrange(indust,607,679) ) & inrange(year,2003,2015)
replace indust=6 if inrange(indust,407,579) & inrange(year,2003,2015)
replace indust=7 if inrange(indust,687,719) & inrange(year,2003,2015)
replace indust=8 if inrange(indust,727,749) & inrange(year,2003,2015)
replace indust=9 if inrange(indust,786,848) & inrange(year,2003,2015)
replace indust=10 if inrange(indust,856,869) & inrange(year,2003,2015)
replace indust=11 if (inrange(indust,877,929) | inrange(indust,757,779) ) & inrange(year,2003,2015)
replace indust=12 if inrange(indust,937,987) & inrange(year,2003,2015)



*************************************************************************************

/*now for occupation*/


/*
template from 99 to 01

1 	1 - 195 	Professional, Technical, and Kindred Workers
2	201 - 245 	Managers and Administrators, except Farm
3 	260 - 285 	Sales Workers
4 	301 - 395 	Clerical and Kindred Workers
5 	401 - 600 	Craftsman and Kindred Workers
6 	601 - 695 	Operatives, except Transport
7 	701 - 715 	Transport Equipment Operatives
8 	740 - 785 	Laborers, except Farm
9	801 - 802 	Farmers and Farm Managers
10	821 - 824 	Farm Laborers and Farm Foremen
11 	901 - 965 	Service Workers, except Private Household
12	980 - 984 	Private Household Workers




*/

replace occ=1 if inrange(occ,1,195) & inrange(year,1999,2001)
replace occ=2 if inrange(occ,201,245) & inrange(year,1999,2001)
replace occ=3 if inrange(occ,260,285) & inrange(year,1999,2001)
replace occ=4 if inrange(occ,301,395) & inrange(year,1999,2001)
replace occ=5 if inrange(occ,401,600) & inrange(year,1999,2001)
replace occ=6 if inrange(occ,601,695) & inrange(year,1999,2001)
replace occ=7 if inrange(occ,701,715) & inrange(year,1999,2001)
replace occ=8 if inrange(occ,740,785) & inrange(year,1999,2001)
replace occ=9 if inrange(occ,801,802) & inrange(year,1999,2001)
replace occ=10 if inrange(occ,821,824) & inrange(year,1999,2001)
replace occ=11 if inrange(occ,901,965) & inrange(year,1999,2001)
replace occ=12 if inrange(occ,980,997) & inrange(year,1999,2001)



/*03 - 15 key

1	1 - 43 		Management Occupations
2	50 - 73 	Business Operations Specialists
3	80 - 95 	Financial Specialists
4	100 - 124 	Computer and Mathematical Occupations
5	130 - 156 	Architecture and Engineering Occupations
6	160 - 196 	Life, Physical, and Social Science Occupations
7	200 - 206 	Community and Social Services Occupations
8	210 - 215 	Legal Occupations
9	220 - 255 	Education, Training, and Library Occupations
10	260 - 296 	Arts, Design, Entertainment, Sports, and Media Occupations
11	300 - 354 	Healthcare Practitioners and Technical Occupations
12	360 - 365 	Healthcare Support Occupations
13	370 - 395 	Protective Service Occupations
14	400 - 416 	Food Preparation and Serving Occupations
15	420 - 425 	Building and Grounds Cleaning and Maintenance Occupations
16	430 - 465 	Personal Care and Service Occupations
17	470 - 496 	Sales Occupations
18	500 - 593 	Office and Administrative Support Occupations
19	600 - 613 	Farming, Fishing, and Forestry Occupations
20	620 - 676 	Construction Trades
21	680 - 694 	Extraction Workers
22	700 - 762 	Installation, Maintenance, and Repair Workers
23	770 - 896 	Production Occupations
24	900 - 975 	Transportation and Material Moving Occupations
25	980 - 983 	Military Specific Occupations

again i code down

*/



//year 03- 15
// some codes not usable anymore 
// 13 is military

replace occ=2 if inrange(occ,1,43) & inrange(year,2003,2015)
replace occ=1 if inrange(occ,50,354) & inrange(year,2003,2015)
replace occ=3 if inrange(occ,470,496) & inrange(year,2003,2015)
replace occ=4 if inrange(occ,500,593) & inrange(year,2003,2015)
replace occ=5 if  inrange(occ,620,676)  & inrange(year,2003,2015)
replace occ=6 if inrange(occ,680,762) & inrange(year,2003,2015)
replace occ=7 if inrange(occ,900,975) & inrange(year,2003,2015)
replace occ=8 if inrange(occ,770,896) & inrange(year,2003,2015)
replace occ=10 if inrange(occ,600,615) & inrange(year,2003,2015)
replace occ=11 if  inrange(occ,360,465)  & inrange(year,2003,2015)
replace occ=13 if  inrange(occ,980,983)  & inrange(year,2003,2015)







